package com.briup.mt.web.controller;

import com.briup.mt.bean.BaseRole;
import com.briup.mt.bean.BaseRolePrivilege;
import com.briup.mt.service.IBaseRolePrivilegeService;
import com.briup.mt.service.IBaseRoleService;
import com.briup.mt.utils.ExcelUtils;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @version 1.0
 * @auther YJ
 * @date 2020/12/17 9:56
 */
@Validated
@RestController
@RequestMapping("/base_role_privilege")
public class BaseRolePrivilegeController {
    @Autowired
    private IBaseRolePrivilegeService baseRolePrivilegeService;
    @GetMapping("select")
    public Message query(Long roleId){
        List<BaseRolePrivilege> list = baseRolePrivilegeService.query(roleId);
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseRolePrivilege baseRolePrivilege){
        baseRolePrivilegeService.saveOrUpdate(baseRolePrivilege);
        return MessageUtil.success("操作成功");
    }
    @DeleteMapping("deleteByID")
    @ApiImplicitParams({@ApiImplicitParam(name = "role_id",value="角色地址",required =true, paramType = "query"),})

    public Message deleteByID(@NotNull long id){
        baseRolePrivilegeService.deleteById(id);
        return MessageUtil.success("操作成功");
    }
}


